/*
============================================================================
Name        : eStockDocument.cpp
Author      : 王斌
Version     :
Copyright   : 益盟软件
Description : Application document class (model)
============================================================================
*/

// INCLUDE FILES
#include "eStockAppUi.h"
#include "eStockDocument.h"
#include "GprsTools.h"

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CeStockDocument::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CeStockDocument* CeStockDocument::NewL( CEikApplication&
									   aApp )
{
	CeStockDocument* self = NewLC( aApp );
	CleanupStack::Pop( self );
	return self;
}

// -----------------------------------------------------------------------------
// CeStockDocument::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CeStockDocument* CeStockDocument::NewLC( CEikApplication&
										aApp )
{
	CeStockDocument* self =
		new ( ELeave ) CeStockDocument( aApp );

	CleanupStack::PushL( self );
	self->ConstructL();
	return self;
}

// -----------------------------------------------------------------------------
// CeStockDocument::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CeStockDocument::ConstructL()
{
	g_GprsTool = CGprsTools::NewL();
}

// -----------------------------------------------------------------------------
// CeStockDocument::CeStockDocument()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CeStockDocument::CeStockDocument( CEikApplication& aApp )
: CAknDocument( aApp )
{
	// No implementation required
}

// ---------------------------------------------------------------------------
// CeStockDocument::~CeStockDocument()
// Destructor.
// ---------------------------------------------------------------------------
//
CeStockDocument::~CeStockDocument()
{
	if(g_GprsTool != NULL)
	{
		delete g_GprsTool;
		g_GprsTool = NULL;
	}
}

// ---------------------------------------------------------------------------
// CeStockDocument::CreateAppUiL()
// Constructs CreateAppUi.
// ---------------------------------------------------------------------------
//
CEikAppUi* CeStockDocument::CreateAppUiL()
{
	// Create the application user interface, and return a pointer to it;
	// the framework takes ownership of this object
	return ( static_cast <CEikAppUi*> ( new ( ELeave )
		CeStockAppUi(g_GprsTool) ) );
}

// End of File
